// @ts-ignore

 
import { api } from '@/utils/api';

/** 翻译 POST /common/cron/translate */
export async function commonCronTranslate(
  body: BIZAPI.CronTranslateReq,
  options?: ArgumentsType<typeof api>[1]
): Promise<BIZAPI.IResultString>;

export async function commonCronTranslate(
  body: BIZAPI.CronTranslateReq,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BIZAPI.IResultString>>;

export async function commonCronTranslate(
  body: BIZAPI.CronTranslateReq,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BIZAPI.IResultString>;

export async function commonCronTranslate(
  body: BIZAPI.CronTranslateReq,
  options?: ArgumentsType<typeof api>[1]
) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BIZAPI.IResultString>(`/app/common/cron/translate`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BIZAPI.IResultString>(`/app/common/cron/translate`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  });
}
